import router from "./router"
import { getLocationToken } from "./utils/auth"

const whiteRoutes = ["/login","/404"]

router.beforeEach((to,from,next)=>{
  const token = getLocationToken()
  if(token){
    next()
  }else{
    if(whiteRoutes.includes(to.path)){
      next()
    }else{
      next("/login")
    }
  }
})